﻿using Roton.Memory;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Roton.ZZT
{
    /// <summary>
    /// Interface used to bridge raw memory access and high-level ZZT emulation.
    /// </summary>
    interface IMemory
    {
        /// <summary>
        /// Board Info interface. Works with board properties such as time limit and darkness.
        /// </summary>
        IBoard Board { get; }

        /// <summary>
        /// Dump memory.
        /// </summary>
        byte[] Dump();

        /// <summary>
        /// Generate an element properties interface for the specified index.
        /// </summary>
        /// <param name="index">Index of the element.</param>
        /// <returns></returns>
        IElement GetElement(int index);

        /// <summary>
        /// Get the Act code for an element.
        /// </summary>
        /// <param name="index">Index of the element.</param>
        /// <returns></returns>
        ActDelegate GetElementActCode(int index);

        /// <summary>
        /// Get the Draw code for an element.
        /// </summary>
        /// <param name="index">Index of the element.</param>
        /// <returns></returns>
        DrawDelegate GetElementDrawCode(int index);

        /// <summary>
        /// Get the index of an element by type.
        /// </summary>
        /// <param name="type">Type to retrieve.</param>
        int GetElementIndexFromType(ElementType type);

        /// <summary>
        /// Get the Interact code for an element.
        /// </summary>
        /// <param name="index">Index of the element.</param>
        /// <returns></returns>
        InteractDelegate GetElementInteractCode(int index);

        /// <summary>
        /// Get the Type of an element.
        /// </summary>
        /// <param name="index">Index of the element.</param>
        ElementType GetElementType(int index);

        /// <summary>
        /// Generate a thing properties interface for the specified index.
        /// </summary>
        /// <param name="index">Index of the thing.</param>
        /// <returns></returns>
        IThing GetThing(int index);

        /// <summary>
        /// State interface. Works with global values.
        /// </summary>
        IState State { get; }

        /// <summary>
        /// World Info interface. Works with player info such as ammo and gems.
        /// </summary>
        IWorld World { get; }
    }
}
